# (C) Datadog, Inc. 2023-present
# All rights reserved
# Licensed under a 3-clause BSD style license (see LICENSE)

# https://weaviate.io/developers/weaviate/configuration/monitoring
METRICS = {
    # General metrics
    'go_gc_duration_seconds': 'go.gc.duration.seconds',
    'go_goroutines': 'go.goroutines',
    'go_info': "go.info",
    'go_memstats_alloc_bytes': {'name': 'go.memstats.alloc_bytes', 'type': 'native_dynamic'},
    'go_memstats_buck_hash_sys_bytes': 'go.memstats.buck_hash.sys_bytes',
    'go_memstats_frees': 'go.memstats.frees',
    'go_memstats_gc_cpu_fraction': 'go.memstats.gc.cpu_fraction',
    'go_memstats_gc_sys_bytes': 'go.memstats.gc.sys_bytes',
    'go_memstats_heap_alloc_bytes': 'go.memstats.heap.alloc_bytes',
    'go_memstats_heap_idle_bytes': 'go.memstats.heap.idle_bytes',
    'go_memstats_heap_inuse_bytes': 'go.memstats.heap.inuse_bytes',
    'go_memstats_heap_objects': 'go.memstats.heap.objects',
    'go_memstats_heap_released_bytes': 'go.memstats.heap.released_bytes',
    'go_memstats_heap_sys_bytes': 'go.memstats.heap.sys_bytes',
    'go_memstats_lookups': 'go.memstats.lookups',
    'go_memstats_mallocs': 'go.memstats.mallocs',
    'go_memstats_mcache_inuse_bytes': 'go.memstats.mcache.inuse_bytes',
    'go_memstats_mcache_sys_bytes': 'go.memstats.mcache.sys_bytes',
    'go_memstats_mspan_inuse_bytes': 'go.memstats.mspan.inuse_bytes',
    'go_memstats_mspan_sys_bytes': 'go.memstats.mspan.sys_bytes',
    'go_memstats_next_gc_bytes': 'go.memstats.next.gc_bytes',
    'go_memstats_other_sys_bytes': 'go.memstats.other.sys_bytes',
    'go_memstats_stack_inuse_bytes': 'go.memstats.stack.inuse_bytes',
    'go_memstats_stack_sys_bytes': 'go.memstats.stack.sys_bytes',
    'go_memstats_sys_bytes': 'go.memstats.sys_bytes',
    'go_threads': 'go.threads',
    'process_cpu_seconds': 'process.cpu.seconds',
    'process_max_fds': 'process.max_fds',
    'process_open_fds': 'process.open_fds',
    'process_resident_memory_bytes': 'process.resident_memory.bytes',
    'process_start_time_seconds': 'process.start_time.seconds',
    'process_virtual_memory_bytes': 'process.virtual_memory.bytes',
    'process_virtual_memory_max_bytes': 'process.virtual_memory.max_bytes',
    'promhttp_metric_handler_requests': 'promhttp.metric_handler.requests',
    'promhttp_metric_handler_requests_in_flight': 'promhttp.metric_handler.requests_in_flight',
    # Weaviate specific metrics
    'batch_durations_ms': 'batch.durations_ms',
    'batch_delete_durations_ms': 'batch.delete.durations_ms',
    'objects_durations_ms': 'objects.durations_ms',
    'object_count': 'objects',
    'async_operations_running': 'async.operations.running',
    'lsm_active_segments': 'lsm.active.segments',
    'lsm_bloom_filters_duration_ms': 'lsm.bloom.filters.duration_ms',
    'lsm_segment_objects': 'lsm.segment.objects',
    'lsm_segment_size': 'lsm.segment.size',
    'lsm_segment_count': 'lsm.segments',
    'vector_index_tombstones': 'vector.index.tombstones',
    'vector_index_tombstone_cleanup_threads': 'vector.index.tombstone.cleanup.threads',
    'vector_index_tombstone_cleaned': 'vector.index.tombstone.cleaned',
    'vector_index_operations': 'vector.index.operations',
    'vector_index_size': 'vector.index.size',
    'vector_index_maintenance_durations_ms': 'vector.index.maintenance.durations_ms',
    'vector_index_durations_ms': 'vector.index.durations_ms',
    'startup_durations_ms': 'startup.durations_ms',
    'startup_diskio_throughput': 'startup.diskio.throughput',
    # Undocumented metrics, but found in code: https://github.com/weaviate/weaviate/blob/master/usecases/monitoring/prometheus.go#L81
    'concurrent_queries_count': 'concurrent.queries',
    'queries_durations_ms': 'queries.durations_ms',
    'queries_filtered_vector_durations_ms': 'queries.filtered.vector.durations_ms',
    'concurrent_goroutines': 'concurrent.goroutines',
    'lsm_memtable_size': 'lsm.memtable.size',
    'lsm_memtable_durations_ms': 'lsm.memtable.durations_ms',
    'vector_dimensions_sum': 'vector.dimensions',
    'startup_progress': 'startup.progress',
    'query_dimensions': 'query.dimensions',
    'backup_restore_ms': 'backup.restore.ms',
    'backup_restore_class_ms': 'backup.restore.class.ms',
    'backup_restore_init_ms': 'backup.restore.init.ms',
    'backup_restore_from_backend_ms': 'backup.restore.from.backend.ms',
    'backup_store_to_backend_ms': 'backup.store.to.backend.ms',
    'bucket_pause_durations_ms': 'bucket.pause.durations.ms',
    'backup_restore_data_transferred': 'backup.restore.data.transferred',
    'backup_store_data_transferred': 'backup.store.data.transferred',
    # Weaviate 1.20.0+ only
    'requests_total': 'requests',
}
